/*
 * Copyright (c) 2020-2099 the original author or authors. All rights reserve.
 */
package org.tianyun.cloud.dashboard.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.tianyun.cloud.common.dto.PageRequest;
import org.tianyun.cloud.common.dto.PageResult;
import org.tianyun.cloud.mybatis.plugins.PageHelper;
import org.tianyun.cloud.dashboard.mapper.ShardingTestMapper;
import org.tianyun.cloud.dashboard.service.ShardingTestService;
import org.tianyun.cloud.utils.PageBuilder;

import java.util.List;
import java.util.Map;

/**
 * @auther ebert_chan
 */
@Service
public class ShardingTestServiceImpl implements ShardingTestService {

    @Autowired
    private ShardingTestMapper shardingTestMapper;

    /*
     * @see org.tianyun.cloud.sample.service.ShardingTestService#get(long)
     */
    @Override
    public String get(long memberId) {
        return shardingTestMapper.get(memberId);
    }

    @Override
    public PageResult<Map<String, Object>> list(PageRequest request) {
        PageBuilder<Map<String, Object>> pb = PageHelper.startPage(request);
        List<Map<String, Object>> data = shardingTestMapper.list();
        pb.setResult(data);
        return pb.build();
    }

}
